const webpack = require('webpack');
const ModuleConcatenationPlugin = require('webpack/lib/optimize/ModuleConcatenationPlugin');

module.exports = function override(config, env) {
  // 生产环境启用插件
  if (env === 'production') {
    config.plugins.push(
      new ModuleConcatenationPlugin(),
      new webpack.DefinePlugin({
        'process.env.NODE_ENV': JSON.stringify('production')
      })
    );
  }

  return config;
}